<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <div id="app">
        <input type="text" v-model.number="num" />
        <input type="text" v-model.number="age" />
        <button @click="handle">点击改变</button>
    </div>
    <script src="../vue.js"></script>
    <script>
        var vm = new Vue({
            el: ' #app ',
            data: {
                num: 0,
                age: 1,
            },
            methods: {
                handle: function() {
                    this.num += 10;
                    this.age += 1;
                },
            },
            watch: {
                num: function(newVal) {
                    console.log(newVal);
                },
                age: function(newAge) {
                    console.log(newAge);
                },
            },
        });
    </script>
</body>

</html>